package com.project.livetv.fragment;


import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.project.livetv.R;
import com.project.livetv.activity.InformationActivity;
import com.project.livetv.activity.MessageActivity;
import com.project.livetv.activity.SettingActivity;


/**
 * Created by li on 2016/5/9.
 */
public class PeopleFragment extends BaseFragment implements View.OnClickListener{
    private String content;
    private RelativeLayout mRelativeLayout;
    private ImageView mImageEdit,mImageExit;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle bundle=getArguments();
        content=bundle.getString("content");
    }

    public static PeopleFragment newInstance(String content) {

        Bundle args = new Bundle();
        args.putString("content", content);
        PeopleFragment fragment = new PeopleFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View root=inflater.inflate(R.layout.people_fragment_layout,container,false);
        mRelativeLayout = (RelativeLayout) root.findViewById(R.id.rlv_my_setting);
        mImageEdit = (ImageView) root.findViewById(R.id.iv_my_top_edit);
        mImageExit = (ImageView) root.findViewById(R.id.iv_my_top_info);
        setListener();
        return root;
    }

    private void setListener() {

        mRelativeLayout.setOnClickListener(this);
        mImageEdit.setOnClickListener(this);
        mImageExit.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        if(v!=null){
            Intent intent = new Intent();
            switch (v.getId()){
                case R.id.iv_my_top_edit:
                    intent.setClass(getContext(), InformationActivity.class);
                    break;
                case R.id.iv_my_top_info:
                    intent.setClass(getContext(), MessageActivity.class);
                    break;
                case R.id.rlv_my_setting:
                    intent.setClass(getContext(), SettingActivity.class);
                    getActivity().overridePendingTransition(R.anim.activity_zoom_in,R.anim.activity_zoom_out);
                    break;
            }
            getActivity().startActivity(intent);
        }

    }
}
